package java19_1_22;

public class MyClass<T, E> {
    T value1;
    E value2;

    public static void main(String[] args) {
        //创建这个泛型类的时候明确类型为整型
        MyClass<Integer, Integer> myClass = new MyClass<>();
        myClass.value1 = 10;
        // myClass.value2 = "123";此时报错语句，因为创建对象时，声明为Integer型
        //创建多个类型
        MyClass<Integer, String> myClass1 = new MyClass<>();
        myClass1.value1 = 20;
        myClass1.value2 = "213"; //此时编译正确
    }

    public T getValue1() {
        return value1;
    }

    public void setValue1(T value1) {
        this.value1 = value1;
    }

    public E getValue2() {
        return value2;
    }

    public void setValue2(E value2) {
        this.value2 = value2;
    }
}
